<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Python Test Function Reference &mdash; MCC DAQ HAT Library 1.5.0 documentation</title>
      <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b76e3c8a" />
      <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />

  
    <link rel="shortcut icon" href="_static/favicon.ico"/>
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="_static/jquery.js?v=5d32c60e"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="_static/documentation_options.js?v=e0a75244"></script>
        <script src="_static/doctools.js?v=888ff710"></script>
        <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            MCC DAQ HAT Library
          </a>
              <div class="version">
                1.5.0
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
<li class="toctree-l1"><a class="reference internal" href="overview.html">Hardware Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="hardware.html">Installing the DAQ HAT board</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installing and Using the Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="c.html">C Library Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Library Reference</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">MCC DAQ HAT Library</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">Python Test Function Reference</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/python_test.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="python-test-function-reference">
<h1>Python Test Function Reference<a class="headerlink" href="#python-test-function-reference" title="Link to this heading"></a></h1>
<p>These functions are included for manufacturing test and not targeted for the end user.</p>
<section id="mcc-118-test-methods">
<h2>MCC 118 test methods<a class="headerlink" href="#mcc-118-test-methods" title="Link to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">daqhats.</span></span><span class="sig-name descname"><span class="pre">mcc118</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">address</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>The class for an MCC 118 board.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board did not respond or was of an incorrect type</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_clock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mode</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>Test the sample clock pin (CLK).</p>
<p>This function exercises the CLK pin in output mode and returns the value
read at the pin for input testing.  Return the mode to input after
testing the pin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>mode</strong> (<em>int</em>) – The CLK pin mode</p>
<ul class="simple">
<li><p>0 = input</p></li>
<li><p>1 = output low</p></li>
<li><p>2 = output high</p></li>
<li><p>3 = output 1 kHz square wave</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The value read at the CLK pin after applying the mode (0 or 1.)</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>int</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p></li>
<li><p><strong>ValueError</strong> – the mode is invalid.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_trigger</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Test the external trigger pin (TRIG).</p>
<p>This value read at the pin for input testing.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The value read at the TRIG pin (0 or 1.)</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>int</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</section>
<section id="mcc-128-test-methods">
<h2>MCC 128 test methods<a class="headerlink" href="#mcc-128-test-methods" title="Link to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">daqhats.</span></span><span class="sig-name descname"><span class="pre">mcc128</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">address</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>The class for an MCC 128 board.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board did not respond or was of an incorrect type</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_clock</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mode</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>Test the sample clock pin (CLK).</p>
<p>This function exercises the CLK pin in output mode and returns the value
read at the pin for input testing.  Return the mode to input after
testing the pin.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>mode</strong> (<em>int</em>) – The CLK pin mode</p>
<ul class="simple">
<li><p>0 = input</p></li>
<li><p>1 = output low</p></li>
<li><p>2 = output high</p></li>
<li><p>3 = output 1 kHz square wave</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The value read at the CLK pin after applying the mode (0 or 1.)</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>int</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p></li>
<li><p><strong>ValueError</strong> – the mode is invalid.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_trigger</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Test the external trigger pin (TRIG).</p>
<p>This value read at the pin for input testing.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>The value read at the TRIG pin (0 or 1.)</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>int</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</section>
<section id="mcc-172-test-methods">
<h2>MCC 172 test methods<a class="headerlink" href="#mcc-172-test-methods" title="Link to this heading"></a></h2>
<dl class="py class">
<dt class="sig sig-object py">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">daqhats.</span></span><span class="sig-name descname"><span class="pre">mcc172</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">address</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>The class for an MCC 172 board.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board did not respond or was of an incorrect type</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_signals_read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Read the state of shared signals for testing.</p>
<p>This function reads the state of the ADC clock, sync, and trigger
signals. Use it in conjunction with <a class="reference internal" href="python.html#daqhats.mcc172.a_in_clock_config_write" title="daqhats.mcc172.a_in_clock_config_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_clock_config_write()</span></code></a>
and <a class="reference internal" href="python.html#daqhats.mcc172.trigger_config" title="daqhats.mcc172.trigger_config"><code class="xref py py-func docutils literal notranslate"><span class="pre">trigger_config()</span></code></a> to put the signals into slave mode then
set values on the signals using the Raspberry Pi GPIO pins. This method
will return the values present on those signals.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p><p>A namedtuple containing the following field names:</p>
<ul class="simple">
<li><p><strong>clock</strong> (int): The current value of the clock signal (0 or 1).</p></li>
<li><p><strong>sync</strong> (int): The current value of the sync signal (0 or 1).</p></li>
<li><p><strong>trigger</strong> (int): The current value of the trigger signal
(0 or 1).</p></li>
</ul>
</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>namedtuple</p>
</dd>
<dt class="field-odd">Raises<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">test_signals_write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mode</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">clock</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sync</span></span></em><span class="sig-paren">)</span></dt>
<dd><p>Write values to shared signals for testing.</p>
<p>This function puts the shared signals into test mode and sets them to
the specified state. The signal levels can then be read on the Raspberry
Pi GPIO pins to confirm values. Return the device to normal mode when
testing is complete.</p>
<p>ADC conversions will not occur while in test mode. The ADCs require
synchronization after exiting test mode, so use
<a class="reference internal" href="python.html#daqhats.mcc172.a_in_clock_config_write" title="daqhats.mcc172.a_in_clock_config_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_clock_config_write()</span></code></a> to perform synchronization.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mode</strong> (<em>int</em>) – Set to 1 for test mode or 0 for normal mode.</p></li>
<li><p><strong>clock</strong> (<em>int</em>) – The value to write to the clock signal in test mode
(0 or 1).</p></li>
<li><p><strong>sync</strong> (<em>int</em>) – The value to write to the sync signal in test mode
(0 or 1).</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="python.html#daqhats.HatError" title="daqhats.HatError"><strong>HatError</strong></a> – the board is not initialized, does not respond, or
    responds incorrectly.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</section>
</section>


           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2020, Measurement Computing.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>